<?php

/**
 * O2O团购PC版本
 * ============================================================================
 * * 版权所有 2009-2016 郑州司科计算机科技有限公司，并保留所有权利。
 * 购买网址: http://www.jzphp.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
  * 咨询电话：400-823-0371 QQ：313999875
 * ============================================================================
 * $Author: zzsike $
 * $Time 2016-02-03 sammy $
*/

require_once(dirname(__FILE__) . '/app.php');
$now = time();
/*商家分类*/
$partner_cat = DB::LimitQuery('category', array('condition'=>array(
		  'zone'=>'partner',
		  'display'=>'Y',
		  ), 
		'order' => 'ORDER BY display ,sort_order DESC, id DESC',
		'size'=>5
));
$cat_partner = array();
foreach($partner_cat as $key=>$val){
        $cat_partner[$key]['name'] = $val[name];
		$cat_partner[$key]['ename'] = $val[ename];
		$cat_partner[$key]['id'] = $val[id];
		$cat_partner[$key]['number'] = Table::Count('partner', array('group_id'=>$val[id],'city_id'=>$cid,'display'=>'Y'));
		$cat_partner[$key]['partner'] = DB::LimitQuery('partner', array(
			'condition' => array('group_id'=>$val[id],'city_id'=>$city[id],'display'=>'Y','brands'=>'Y'),
			'order' => "ORDER BY head DESC, id DESC",
		));
}

//品牌店轮换广告			
$banner_store = array(
				'display'=>'Y',
				"begin_time <= ".$now,
				"end_time > ".$now,
				'position' => 'store',
			);
$banner_stores = DB::LimitQuery('banner', array(
				'condition' => $banner_store,
				'order' => 'ORDER BY sort_order DESC, id DESC',
			));		
			//品牌店轮换广告下1			
$banner_bottom_one = array(
				'display'=>'Y',
				"begin_time <= ".$now,
				"end_time > ".$now,
				'position' => 'one',
			);
$banner_bottom_ones = DB::LimitQuery('banner', array(
				'condition' => $banner_bottom_one,
				'order' => 'ORDER BY sort_order DESC, id DESC',
			));		
			//品牌店轮换广告下2			
$banner_bottom_two = array(
				'display'=>'Y',
				"begin_time <= ".$now,
				"end_time > ".$now,
				'position' => 'two',
			);
$banner_bottom_twos = DB::LimitQuery('banner', array(
				'condition' => $banner_bottom_two,
				'order' => 'ORDER BY sort_order DESC, id DESC',
			));	
			//品牌店轮换广告下3			
$banner_bottom_three = array(
				'display'=>'Y',
				"begin_time <= ".$now,
				"end_time > ".$now,
				'position' => 'three',
			);
$banner_bottom_threes = DB::LimitQuery('banner', array(
				'condition' => $banner_bottom_three,
				'order' => 'ORDER BY sort_order DESC, id DESC',
			));	
			//品牌店轮换广告下4		
$banner_bottom_four = array(
				'display'=>'Y',
				"begin_time <= ".$now,
				"end_time > ".$now,
				'position' => 'four',
			);
$banner_bottom_fours = DB::LimitQuery('banner', array(
				'condition' => $banner_bottom_four,
				'order' => 'ORDER BY sort_order DESC, id DESC',
			));	

$pagetitle = '品牌店';
include template('store');


